package runesim.testing;
import runesim.node.model.*;
public class RuneScriptMethods {

			Player player;
	
			public RuneScriptMethods(Player p){
				player = p;
			}
			
			//begin
			
			/***
			 * Test the player's gender, useful for getting gender specific language correct in the scripts.
			 * DONE
			 */
			public boolean ifmale(){
				return player.getAppearance().getGender() == 0;
			}
			
			/**
			 * 	Displays the specified shop dialog, and allows the player to buy and sell items.
			 * @param shop		Shop ID to open.
			 */
			public void openshop(int shop){
				return;
			}
			
			/***
			 * Randomly sets the condition flag to true or false. 
			 * A probability of 0=impossible, and 256=certain
			 * @param probability		Probability to consider.
			 * @return
			 * DONE
			 */
			public boolean ifrandom(int probability){
				long r = (long)((Math.random() * 100000) % 100) + 1;
			    long cutoff= (long)(probability * 100);
			    return r < cutoff;
			}
			
			/***
			 * Displays the specified message at the bottom of the player screen.
			 * @param s		The string to display.
			 * DONE
			 */
			public void mes(String s){
				player.getActionSender().sendMessage(s);
			}
			
			/***
			 * Makes the players character say the specified string, all nearby people will also see this.
			 * @param s		The string to display.
			 * DONE
			 */
			public void say(String s){
				player.setTextOverheadMessage(s);
			}
			
			/**
			 * Displays a multiple choice menu with 2 items, depending which the 
			 * players chooses the relevant block of script will be called. 
			 * Note: The player may decide not to choose either item in which case the script terminates.
			 * @param string1
			 * @param label1
			 * @param string2
			 * @param label2
			 */
			public void multi2(String string1, String label1, String string2, String label2){
				return;
			}
			
			/**
			 * Displays a multiple choice menu with 3 items, depending which the 
			 * players chooses the relevant block of script will be called. 
			 * Note: The player may decide not to choose either item in which case the script terminates.
			 * @param string1
			 * @param label1
			 * @param string2
			 * @param label2
			 * @param string3
			 * @param label3
			 */
			public void multi3(String string1, String label1, String string2, String label2, String string3, String label3){
				return;
			}
			
			/**
			 * Displays a multiple choice menu with 4 items, depending which the 
			 * players chooses the relevant block of script will be called. 
			 * Note: The player may decide not to choose either item in which case the script terminates.
			 * @param string1
			 * @param label1
			 * @param string2
			 * @param label2
			 * @param string3
			 * @param label3
			 * @param string4
			 * @param label4
			 */
			public void multi4(String string1, String label1, String string2, String label2, String string3, String label3, String string4, String label4){
				return;
			}
			
			/***
			 * Moves the player to the specified level, without changing the x and y position.
			 * Level-codes: 0=ground floor, 1=1st floor, 2=2nd floor, 3=3rd floor, etc...
			 * @param level
			 * DONE
			 */
			public void changelevel(int level){
				player.getLocation().setHeight(level);
				player.setMapAreaChanged(true);
				return;
			}
			
			/***
			 * Moves the player up one level if possible.
			 * DONE
			 */
			public void changelevelup(){
				int level = player.getLocation().getHeight();
				
				if(level+1 > 3) return;
				else {
					player.getLocation().setHeight(level+1);
					player.setMapAreaChanged(true);
				}
			}
			
			/***
			 * Moves the player down one level if possible.
			 * DONE
			 */
			public void changeleveldown(){
				int level = player.getLocation().getHeight();
				
				if(level-1 < 0) return;
				else {
					player.getLocation().setHeight(level-1);
					player.setMapAreaChanged(true);
				}
			}
}